<template>
  <Editor :value="value" :plugins="plugins" @change="handleChange"  mode="split"  />
</template>

<script setup lang="ts">
import gfm from "@bytemd/plugin-gfm";
import highlight from "@bytemd/plugin-highlight";
import { Editor, Viewer } from "@bytemd/vue-next";
import { ref,withDefaults,defineProps } from "vue";

/***
 * 接收父组件传值的接口
 */
interface Props{
  value:string;
  handleChange:(v:string)=> void;
}

/**
 * 如果父组件没有传值，就会给一个默认值
 */
const props = withDefaults(defineProps<Props>(),{
  value:()=>"",
  handleChange:(v:string)=>{

  }
})

const plugins = [
  gfm(),
  highlight(),
];

</script>

<style scoped></style>